/**
 * 
 */
package com.ubo.java.model.classifier;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import com.ubo.java.model.EVisibility;
import com.ubo.java.model.PackageModel;
import com.ubo.java.model.comment.Comment;
import com.ubo.java.model.methode.Method;
import com.ubo.java.model.methode.Prototype;
import com.ubo.transform.java.IJavaVisitor;

/**
 * @author saludegu
 * 
 */
public class EnumClassifier extends AClassifier {

	/**
	 * Valeurs de l'enum.
	 */
	protected final Set<String> mValues;

	/**
	 * Set de méthodes.
	 */
	protected Set<Method> mMethodesSet;

	/**
	 * Constructor
	 * 
	 * @param classifierName
	 */
	public EnumClassifier(String enumName, PackageModel packageEnum,
			EVisibility visibility, String... values) {
		super(enumName, packageEnum, visibility);
		mValues = new HashSet<String>();
		for (String value : values)
			mValues.add(value);
		mComment = new Comment(new StringBuffer("* Enumeration " + enumName
				+ "\n"));
		mComment.setAuthor();
	}

	/**
	 * @return the mValues
	 */
	public Set<String> getValues() {
		return mValues;
	}

	/**
	 * @see com.ubo.transform.java.IJavaGenerable#generate(com.ubo.transform.java.IJavaVisitor)
	 */
	@Override
	public void generate(IJavaVisitor<?> generator) {
		generator.generate(this);
	}

	/**
	 * Ajout d'une méthode à l'énum.
	 * 
	 * @param signature
	 */
	public void addMethod(Method signature) {
		if (mMethodesSet == null)
			mMethodesSet = new HashSet<Method>(0);
		mMethodesSet.add(signature);
	}

	/**
	 * Ajout d'une méthode à l'énum.
	 * 
	 * @param signature
	 */
	public void addAllMethods(Collection<Method> signatures) {
		if (mMethodesSet == null)
			mMethodesSet = new HashSet<Method>(0);
		mMethodesSet.addAll(signatures);
	}

	/**
	 * 
	 * @return mMethodesSet.
	 */
	public Set<Method> getMethods() {
		return mMethodesSet;
	}

	@Override
	Collection<Prototype> getPrototypes() {
		return null;
	}

	@Override
	public void extendsClassifier(IClassifier classifier) {
		classifier.extendsClassifier(this);
	}

	@Override
	public void implementsClassifier(IClassifier classifier) {
		classifier.implementsClassifier(this);
	}

	@Override
	public void implementsClassifier(Interface classifier) {
	}

	@Override
	public void extendsClassifier(ClassModel classifier) {
	}
}
